package com.infotel.cartegrise.listeners;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JTextField;

public class ButtonBouttonListener implements ActionListener {

    private JTextField tfNumeroSerie;

    public ButtonBouttonListener(JTextField tfNumeroSerie) {
        this.tfNumeroSerie = tfNumeroSerie;
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        if (tfNumeroSerie
                .getText()
                .matches(
                        "[0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z][0-9A-Z]")) {
            System.out.println("ok");
        } else {
            System.out.println("pb");
        }
    }

}
